<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
    <%
            String basePath = "http://" + request.getLocalAddr() + ":" + request.getLocalPort() + request.getContextPath();
    %>
    <title>${promptInfo.totalDescInfo}</title>
    <head>
    <s:include value="../../head.jsp"></s:include>
    </head>
    <body >
        <form name="actionForm" method="post" action="decorateForwardAction.action?code=003001001" id="actionForm">
        <input type="hidden" name="imitateStep" value="sys_user_mgr_step_1">
            <script language="JavaScript" type="text/javascript">
            $(window.parent.document).find(".select").removeClass("select");
            $(window.parent.document).find("#pms0").addClass("select");
            var gridtb;
            $(document).ready(function(){	
           	 $('#dongjie').screenTB({
              	windowDocument:window.parent.document,
          		width:'250',
          		height:'150',
          		content:'确认',
          		contentAlign:'center',
          		contentValign:'middle',
          		title:'确认',
      			buttonValueYes:'确定',	
      			buttonValueNo:'取消',	
      			dialogType:'alert',
      			iframeSrc:''
          		},{
          		clickEvent:function(data){
      	    			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
      	    				data = $.extend(data,{content:'请选择您要冻结的用户！'});
      	    				return false;
      	    			}
      	    			else{
          	    			var re =true;
      	    				var userID="";
      	    				$("#grid tbody input[type='checkbox']:checked").each(function(data){
          	    				var allval = $(this).val();
          	    				strs = allval.split('#');
      	                        userID+=strs[0]+",";
      	                        //alert(strs[0]);
      	                        //alert(strs[1]);
      	                        if(strs[1]==0){
    	  	                      
    	  	                      re =  false;
          	                        }
      	    				})
      	    				if(!re){
      	    					data = $.extend(data,{content:'您选择的用户已冻结！'});
								return;
       	    				}
      	    				userID = userID.substring(0,userID.length-1);
      	    				window.location.href = "decorateForwardAction.action?code=003001003&paramMap.userID="+userID+"&paramMap.userStatus=0";
      	    				return re;
      	    			}
          			}
          		});
       		
           	 $('#jiedong').screenTB({
               	windowDocument:window.parent.document,
           		width:'250',
           		height:'150',
           		content:'确认',
           		contentAlign:'center',
           		contentValign:'middle',
           		title:'确认',
       			buttonValueYes:'确定',	
       			buttonValueNo:'取消',	
       			dialogType:'alert',
       			iframeSrc:''
           		},{
           		clickEvent:function(data){
       	    			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
       	    				data = $.extend(data,{content:'请选择您要解冻的用户！'});
       	    				return false;
       	    			}
       	    			else{
       	    				var re =true;
       	    				var userID="";
       	    				$("#grid tbody input[type='checkbox']:checked").each(function(){
       	                        userID+=$(this).val()
       	             		var allval = $(this).val();
      	    				strs = allval.split('#');
  	                        userID+=strs[0]+",";;
  	                        if(strs[1]==1){
  	                      		
  	                      	  re =  false;

  	  	                        }
       	    				})
       	    				if(!re){
       	    					data = $.extend(data,{content:'您选择的用户未冻结！'});
									return;
           	    				}
       	    				userID = userID.substring(0,userID.length-1);
       	    				window.location.href = "decorateForwardAction.action?code=003001003&paramMap.userID="+userID+"&paramMap.userStatus=1";
       	    				return re;
       	    			}
           			}
           		});

           	 $('#xiugai').screenTB({
                	windowDocument:window.parent.document,
            		width:'250',
            		height:'150',
            		content:'确认',
            		contentAlign:'center',
            		contentValign:'middle',
            		title:'确认',
        			buttonValueYes:'确定',	
        			buttonValueNo:'取消',	
        			dialogType:'alert',
        			iframeSrc:''
            		},{
            		clickEvent:function(data){
        	    			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
        	    				data = $.extend(data,{content:'请选择您要修改的用户！'});
        	    				return false;
        	    			} else if ($("#grid tbody input[type='checkbox']:checked").size() > 1 ) {
        	    				data = $.extend(data,{content:'不可一次修改多个用户！'});
        	    				return false;
            	    	    }
        	    			else{
        	    				var userID="";
        	    				$("#grid tbody input[type='checkbox']:checked").each(function(){
        	                        userID+=$(this).val()+",";
        	    				})
        	    				userID = userID.substring(0,userID.length-1);
        	    				window.location.href = "decorateForwardAction.action?code=003001004&paramMap.userID="+userID;
        	    				return true;
        	    			}
            			}
            		});
            
            	$('#grid').gridTB(ujdata,ujoption,$('#pageNumContent'));
                    
            });
        	var ujoption = {
        			columnAlias:function(col,val){
				if(col == 'userGender')
				{
					if (val == '1')
						val = "男";
					else if (val == '2')
						val =  "女";
					else 
						val = '未知';
				}
				if(col == 'userStatus')
				{
					if (val == '1')
						val = "可用";
					else if (val == '0') 
						val = '冻结';
				}
				
				return val;
			}};

            var ujdata = {
        		    globalParam:$("#actionForm").formSerialize(),
        		    //first,last
        	    	checkbox:{name:'选择',type:'first',width:'8%'},
        	    	columnDesc:{
        		    	//列表要显示的列（在json中对应的key）
        				showColumn: ['userName','userGender','userCompany','userDepartment','userCompanyAddress','userOfficePhone','userMobilePhone','userEmail','userStatus'],
        				//列表头显示名称
        				columnName:   ['用户姓名','用户性别','单位','科室','单位地址','办公室电话','手机','EMAIL','状态'],
        				//列表头宽度
        				columnWidth:   ['10%','5%','10%','10%','20%','10%','10%','10%','7%'],
        				//可以作为主键的类，在页面传送的过程中为paramMap.orgID=value的形式
        				//多个主键的时候为["orgID","orgCode"]:paramMap.orgID=value&paramMap.orgCode=value
        				primkeyColumn:["userID","userStatus"]
        				//要增加链接的列，可以为多个
        				//linkColumn:[{name:'',url:'',param:''}]
        	    	},		
        	    	ajax:{
        	        	url:'ajaxAction.action',
        	        	data:'code=003001'
        		    },
        		    //是否有分页工具条
        		    isPagination:'true',	    
        	    	paginationData:{
        				pageSize:'10'
        	    	}		    		 
        		};
            function search(){
            	ujdata = $.extend(ujdata,{globalParam:$("#actionForm").formSerialize(),ajax:{url:'ajaxAction.action',data:'code=003001001'}});
            	$('#grid').gridTB(ujdata,ujoption,$('#pageNumContent'));
            }

           
            
                
           
          
            </script>
            <div id="message__" class="showDiv">
</div>
<div id="screen__">
    <iframe id="iframeScreen__" scrolling="no" frameborder="0">
    </iframe>
</div>
            <div id="breadcrumb"><a href="#">首页</a> 〉账号管理</div>
            
             <div id="operation">
			    <ul class="operationMain">
			      <li><a href="decorateForwardAction.action?code=003001002" id="tesrt" class="new">新建</a></li>
			      <li><img src="<%=basePath %>/images/heaq/userManage_files/u103.png" ><span id="dongjie" valign="middle" onclick="javaScript:dongjie();">冻结</span> </img> </li>
			      <li><img src="<%=basePath %>/images/heaq/userManage_files/u106.png"  ><span id="jiedong"  valign="middle" onclick="javaScript:jiedong();">解冻</span> </img> </li>
			      <li><img src="<%=basePath %>/images/heaq/userManage_files/u98.png" ><span  id="xiugai" valign="middle" onclick="javaScript:xiugai();">修改密码</span></img>  </li>
			      
			    </ul>
			    <div class="search">
			    <span>请输入姓名:</span>
			      <input name="searchMap.userName" id="userExtPhone"   type="text"   />
			      <button type="button" class="btNor" onclick="search();">搜索</button>
			    </div>
			  </div>
             <div class="moduleCon">
   				 <table  width="99%"  class="row">
   				 <tr><td width="100%" id="grid"></td></tr>
   				 
             </table>
			    <table id="pageNumContent" width="99%"   class="pageNumContent" >
			    </table>
			  </div>
            
           
        </form>
    </body>
</HTML>
